<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp" %>
<!DOCTYPE html>
<html lang="en">
<head>
    <!-- header -->
    <%@ include file="/WEB-INF/views/include/header.jsp" %>
</head>
<style>
    #laydate_today{
        display: none !important;
    }
</style>
<body class="no-skin">

<%--修改模态框--%>
<div class="modal fade" id="modify" tabindex="-1" role="dialog" aria-labelledby="categoryModal" aria-hidden="true"
     data-backdrop="static">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                <h4 class="modal-title" id="categoryModal">新增</h4></div>
            <div class="modal-body ">
                <div class="form-group clearfix">
                    <label class="control-label col-sm-2 text-right">事项类型</label>
                    <div class="col-sm-9">
                        <input type="text" class="category form-control">
                    </div>
                </div>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-success categoryIncrease" data-dismiss="modal">确定</button>
                <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
            </div>
        </div><!-- /.modal-content -->
    </div><!-- /.modal -->
</div>
<div class="main-container" id="main-container">
    <!-- /section:basics/sidebar -->
    <div class="main-content">
        <div class="main-content-inner">
            <div class="page-content">
                <%--   功能按钮 --%>
                <div class="row">
                    <div class="col-xs-6">
                        <div class="pull-left">
                            <button class="btn btn-sm btn-success" id="increase">新增</button>
                            <button class="btn btn-sm btn-danger" id="delete">删除</button>
                        </div>
                    </div>
                    <div class="col-xs-6">
                        <div class="pull-right">
                            搜索:<input type="text" name="category">
                            <button class="btn btn-success categoryConfirm"
                                    onclick="confirmBtn(this,'category','/common/releaseBriefing/briefCategory/')">确定</button>
                        </div>
                    </div>
                </div>
                <!-- /section:settings.box -->
                <div class="row">
                    <div class="col-xs-12">
                        <!-- PAGE CONTENT BEGINS -->
                        <!-- jqGrid表格 -->
                        <table id="gridTable"></table>
                        <!-- jqGrid工具类 -->
                        <div id="gridPager"></div>
                        <!-- 查询对话框 -->
                        <div style="display: none;">
                            <div class="row" id="queryDialog"></div>
                        </div>
                        <!-- PAGE CONTENT ENDS -->
                    </div><!-- /.col -->
                </div><!-- /.row -->
            </div><!-- /.page-content -->
        </div>
    </div><!-- /.main-content -->

    <a href="#" id="btn-scroll-up" class="btn-scroll-up btn btn-sm btn-inverse">
        <i class="ace-icon fa fa-angle-double-up icon-only bigger-110"></i>
    </a>

    <%@ include file="/WEB-INF/views/include/dialog.jsp" %>
</div><!-- /.main-container -->

<!-- footer -->
<%@ include file="/WEB-INF/views/include/footer.jsp" %>

<script type="text/javascript">
    // 基本路径
    var baseUrl = "<s:url value="/common/releaseBriefing/briefCategory"></s:url>/"

    // jqgrid的表格高度
    var height = 320;
    // jqgrid表格行头的中文
    var colNames = ['', 'sysId', "事项类型"];

    var colModel = [
        {name: 'sysId', width: 60, hidden: true, key: true},
        {name: 'sysId', index: 'sysId', width: 250, editable: true},
        {name: 'category', index: 'category', width: 250, editable: true},
    ];


    jqgrid({
        gridTableId: "#gridTable",
        gridPagerId: "#gridPager",
        autoScroll: true,
        shrinkToFit: true,
        multiselect:true,
        onSelectRow:function (rowid, status) {}
    });

    //新增
    $("#increase").click(function () {
        $("#modify").modal("show")
    });
    $(".categoryIncrease").click(function () {
        var $category = $("#modify .category").val();
        $.post("/common/releaseBriefing/addCategory",{category:$category},function (res) {
            if (res.code == 200){
                alert("新增成功")
                setTimeout(function () {
                    //刷新当前页面
                    open(location, '_self').close();
                }, 50)
            }
        })
    })

    //删除事项类型
    $("#delete").click(function () {
        showDeleteDialog({
            url: "/common/releaseBriefing/deleteCategory/",
            tableId: "#gridTable",
            confirmTitle: "确认对话框",
            confirmMessage: "是否确定删除?",
            confirmOk: "确定",
            confirmCancel: "取消",
            successMessage: "删除成功",
            successTitle: "消息对话框",
            failMessage: "删除失败",
            failTitle: "消息对话框",
            errorTitle: "警告提示框",
            errorMessage: "您当前尚未选中一行，请选择后再试",
            errorOk: "确定"
        });
    })
</script>

</body>
</html>